import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

/**
 * KeyboardListener receives KeyEvents from View Author: Kyle Van Wie Version
 * v1.3 v1 Initial Version v1.2 Decoupled Version v1.3 Switched Data Structure
 */
/**
 * @author
 * 
 */
public class KeyboardListener extends KeyAdapter {
	DoublyLinkedList<KeyEvent> KeyEvents;

	public KeyboardListener() {
		super();
		KeyEvents = new DoublyLinkedList<KeyEvent>();
	}

	@Override
	public void keyPressed(KeyEvent e) {
		KeyEvents.addBack(e);
	}

	public KeyEvent getKeyEvent() {
		if (KeyEvents.isEmpty()) {
			KeyEvent e = null;
			return e;
		} else {
			return KeyEvents.removeFirst();
		}
	}
}
